package org.mzx.shortLink.adminn.service.handler.chain.userGreateGroup;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.mzx.shortLink.adminn.common.ThreadLocal.threadlocal;
import org.mzx.shortLink.adminn.domain.entity.TUser;
import org.mzx.shortLink.adminn.domain.mapper.TUserMapper;
import org.mzx.shortLink.adminn.dto.Request.ShortLinkGroupSaveReqDTO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author mazhenxi
 * @date 2025/4/25
 * @desc 检查分组数量是否已经到达上线
 */
@Component
@RequiredArgsConstructor
public class userGroupCheckNum implements userCreateGroupChain{

    @Value("${short-link.group.commonMaxCreateSize}")
    private int COMMON_SIZE;

    @Value("${short-link.group.vipMaxCreateSize}")
    private int VIP_SIZE;

    private final TUserMapper tUserMapper;

    @Override
    public void handler(ShortLinkGroupSaveReqDTO requestParam) {
        Long groupCreatCount = tUserMapper.selectCount(Wrappers.lambdaQuery(TUser.class)
                                                                .eq(TUser::getUsername, threadlocal.getLoginUser().getUsername()));
        //检查此用户是不是vip的逻辑

    }

    @Override
    public int getOrder() {
        return 10;
    }
}
